package org.footballmanager.pandafootball.system.form.impl;

import lombok.Getter;
import lombok.Setter;
import org.footballmanager.pandafootball.system.domain.FootLevelUp;
import org.footballmanager.pandafootball.system.form.SearchForm;
import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example;

import java.io.Serializable;

@Setter
@Getter
public class FootLevelUpSearchForm extends SearchForm implements Serializable {
	private static final long serialVersionUID = 8090668615941861527L;
	protected String level;
	protected Long danGradingId;

	public Example buildSearchCommond() {
		Example example = new Example(FootLevelUp.class);
		Example.Criteria criteria = example.createCriteria();
		if(StringUtils.isEmpty(level)){
			criteria.andEqualTo("level", Integer.parseInt(level));
		}
        if(danGradingId != null){
            criteria.andEqualTo("danGradingId", danGradingId);
        }
        criteria.andEqualTo("delFlag", 0);
		example.orderBy("level asc");
		return example;
	}

}
